package mysql

import "gorm.io/gorm"

type Class struct {
	gorm.Model
	Title     string `gorm:"column:title;type:varchar(50);not null;comment:标题"`
	Img       string `gorm:"column:img;type:varchar(100);not null;comment:封面图"`
	IsPay     int    `gorm:"column:is_pay;type:int;not null;comment:是否付费0.免费,1.付费"`
	UserId    int    `gorm:"column:user_id;type:int;not null;comment:用户ID"`
	TypeId    int    `gorm:"column:type_id;type:int;not null;comment:类型ID"`
	Comment   int    `gorm:"column:comment;type:int;not null;comment:评论数"`
	Status    int    `gorm:"column:status;type:int;not null;comment:状态"`
	HighTitle string `gorm:"column:high_title;type:varchar(50);not null;comment:高亮标题"`
}

// 发布课程
func (c *Class) ReleaseClass() error {
	return DB.Create(&c).Error
}
